#include "setting.h"
#include <QDir>

setting::setting(QString FileName)
{
    if (FileName.isEmpty())
    {
        QString filePath = QDir::home().homePath();
        m_SettingFileName = filePath + "/Setting.ini";
    }
    else
    {
        m_SettingFileName = FileName;
    }

    m_SettingFile = new QSettings(m_SettingFileName, QSettings::IniFormat);
}


setting::~setting(void)
{
    delete m_SettingFile;
}


void setting::Set(QString qstrkeyname,QVariant qvarvalue)
{
    m_SettingFile->setValue(QString("/%1").arg(qstrkeyname), qvarvalue);
}

QVariant setting::Get(QString qstrkeyname)
{
    QVariant qvar = m_SettingFile->value(QString("/%1").arg(qstrkeyname));
    return qvar;
}
